<?php 
class JVastLog
{
    static function addLog($thoigian, $ip, $mota, $nguoidung_id, $hosocanbo_id)
    {
        $db = JFactory::getDBO();
        $query = $db->getQuery(true);

        $query->insert('#__nhatkyhethong');
        $query->set('thoigian = ' . $db->quote($thoigian));
        $query->set('ip = ' . $db->quote($ip));
        $query->set('mota = ' . $db->quote($mota));
        $query->set('nguoidung_id = ' . (int)$nguoidung_id);
        $query->set('hosocanbo_id = ' . (int)$hosocanbo_id);

        $db->setQuery($query);
        
        if (!$db->query()) {
            JError::raiseError(500, $db->getErrorMsg());
            return false;
        } else {
            return true;
        }
    }
}